﻿Imports ExpressionMediaPlayer

Partial Public Class MainPage
    Inherits UserControl

    Public Sub New()
        InitializeComponent()
    End Sub

    Public Sub LoadMedia(ByVal mediaSource As String, ByVal title As String, ByVal thumbSource As String, ByVal autoLoad As Boolean, ByVal autoPlay As Boolean)

        If String.IsNullOrEmpty(mediaSource) Then
            Return
        End If

        If (String.IsNullOrEmpty(title)) Then
            title = "Media"
        End If

        Dim playListItem As New PlaylistItem()
        playListItem.MediaSource = New Uri(mediaSource)
        playListItem.Title = title

        If Not String.IsNullOrEmpty(thumbSource) Then
            playListItem.ThumbSource = New Uri(thumbSource)
        End If

        Dim playList As New Playlist()
        playList.AutoLoad = autoLoad
        playList.AutoPlay = autoPlay
        playList.Items.Add(playListItem)

        Me.MediaPlayer.Playlist = playList

    End Sub

End Class